home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / M / MacOberon241.cpt / MacOberon 2.4(1) / RX.Tool (.txt) < prev    next >
Oberon Text  |  1991-10-17  |  3KB  |  71 lines

  1. Syntax10.Scn.Fnt
  2. Syntax12b.Scn.Fnt
  3. RX.SetSearch 
  4. RX.SetReplace
  5. RX.Search
  6. RX.Replace
  7. RX.ReplaceAll
  8. RX.Grep 
  9. -----------------------------------------------------------
  10. Regular Expression Search and Replace Commands
  11. Allows to search and to replace in standard texts using regular expressions. Matched subexpressions
  12. in the search pattern can be named and referred to in the replace pattern, allowing a wide range of
  13. different text modifications. Alternatively, lines containing a certain pattern can be extracted from a
  14. file and displayed in a separate viewer.
  15. RX.SetSearch [option] RegExpr
  16. Sets RegExpr as the current search pattern. 
  17. The end of RegExpr is determined by the end of the command line.
  18. Up to ten factors can be marked as subexpressions.
  19.         RegExpr         =    term { "|" term }.
  20.         term              =    extdfactor { extdfactor }.
  21.         extdfactor     =    factor [ subexprid ].
  22.         factor            =    "(" RegExpr ")" | "[" RegExpr "]" | "{ RegExpr "}" | 
  23.                                     ["~"] ( """ literal """ | shorthand ) | """ literal { literal } """.
  24.         subexprid      =    "X" digit.
  25.         shorthand      =    "A" | "a" | "b" | "c" | "d" | "h" | "i" | "l" | "o" | "t" | "w".
  26.         option           =    "/c".
  27. Predefined character classes and their meaning :
  28.     A    :     "A" - "Z"
  29.     a    :     "a" - "z"
  30.     b    :     "0" - "1"
  31.     c    :      carriage return
  32.     d    :     "0" - "9"
  33.     h    :     "0" - "9" or "A" - "F"
  34.     l     :     character classes A or a
  35.     i     :     character classes l or d
  36.     o    :     "0" - "7"
  37.     t     :     tab
  38.     w   :     tab, carriage return or blank
  39. Option c ignores the case of the letters
  40. RX.SetReplace {""" literal {literal} """ | subexprid | "t" | "c"}
  41. Defines the current replace pattern as a sequence of strings,
  42. subexpressions, tabulator or carriage return characters.
  43. RX.Search
  44. Searches the current search pattern in the focused text. Searching is started at the
  45. position of the caret. If the caret doesn't exist in the focused text, searching
  46. starts at the beginning. The command searches for the longuest pattern,
  47. matching the regular expression ( the same rule is applied to subexpressions ).
  48. RX.Replace
  49. Replaces a found regular expression by the current replace pattern and
  50. searches for the next occurence of the current search pattern.
  51. RX.ReplaceAll
  52. Repeats RX.Replace until the end of text.
  53. The Grep Command
  54. RX.Grep ( filename | "*" ) [option] RegExpr
  55. Searches in the file filename or the marked text for the regular expression
  56. RegExpr. The output will be diplayed in a seperate text viewer.
  57.     option    =    "/" { "c" | "i" }.
  58. Options :
  59.     c    :    Ignores the case of the letters
  60.     i    :    Invert the search and displays only the lines that do not match
  61. Examples
  62. indent (non empty) lines by one tab
  63.     RX.SetSearch (~c {~c} c) X0
  64.     RX.SetReplace t X0
  65. display all procedure headers
  66.     RX.Grep Texts.Mod "PROCEDURE"
  67. generate the parameters for a System.CopyFiles or System.RenameFiles
  68. command from a directory listing
  69.     RX.SetSearch ( i {i|"."} ) X0
  70.     RX.SetReplace X0 " => prefix." X0
  71.